import requests from "@/utils/request";

export function queryAddressTableList(query) {
    return requests({
        url: '/platform/addr/queryAddressTableList',
        method: 'get',
        params: query
    })
}

export function createAddress(receiver, phone, location, full_addr) {
    return requests({
        url: '/platform/addr/createAddress',
        method: 'post',
        data: JSON.stringify({
            receiver,
            phone,
            location,
            full_addr
        })
    })
}

export function queryModifyAddrForm(addrId) {
    return requests({
        url: '/platform/addr/queryModifyAddrForm/' + addrId,
        method: 'get'
    })
}

export function modifyAddress(addr_id, receiver, phone, location, full_addr) {
    return requests({
        url: '/platform/addr/modifyAddress',
        method: 'put',
        data: JSON.stringify({
            addr_id,
            receiver,
            phone,
            location,
            full_addr
        })
    })
}

export function deleteAddr(addrId) {
    return requests({
        url: '/platform/addr/deleteAddr/' + addrId,
        method: 'delete'
    })
}